import pygame,random

class Square():
	def __init__(self,win,s):
		self.win = win
		self.rect = pygame.Rect(s.win[0]/2,s.win[1]/2,
								s.square_width,s.square_width)
		self.color = random.choice(s.square_color)
		self.space = False
		self.fps = s.square_fps
		self.jump = 0
		self.s = s
		self.fall_a = 1
		self.fall_speed = 0
		self.play = False

	def update(self):
		if self.play:
			if self.space:
				self.jump = self.fps
				self.fall_speed = 0
				self.space = False
			if self.jump > 0:
				self.rect.centery -= self.s.square_jump/self.fps
				self.jump -= 1
			else:
				self.fall_speed += self.fall_a
				self.rect.centery += self.fall_speed
		pygame.draw.rect(self.win,self.color,self.rect)